package com.boot.mapreduce;

import java.io.Serializable;

public class Job implements Serializable {
    private String inputPath;
    private Mapper<?,?,?,?> mapper;
    private Reducer<?,?,?,?> reducer;

    public String getInputPath() {
        return inputPath;
    }

    public void setInputPath(String inputPath) {
        this.inputPath = inputPath;
    }

    public void setMapper(Mapper<?, ?, ?, ?> mapper) {
        this.mapper = mapper;
    }

    public void setReducer(Reducer<?, ?, ?, ?> reducer) {
        this.reducer = reducer;
    }

    @SuppressWarnings("unchecked")
    public <K1,V1,K2,V2> Mapper<K1,V1,K2,V2> getMapper() {
        return (Mapper<K1,V1,K2,V2>)mapper;
    }

    @SuppressWarnings("unchecked")
    public <K2,V2,K3,V3> Reducer<K2,V2,K3,V3> getReducer() {
        return (Reducer<K2,V2,K3,V3>)reducer;
    }

    // 内置任务类型
    public static class Task implements Serializable {
        public enum Type { MAP, REDUCE }
        public Type type;
        public int taskId;
    }
}
